cbuffer ConstantBuffer : register(b0)
{
	matrix World;
	matrix View;
	matrix Projection;
	float4 vLightDir[2];
	float4 vLightColor[2];
	float4 vOutputColor;
}

struct DS_OUTPUT
{
	float4 pos  : SV_POSITION;
	float3 norm : NORMAL;
	float2 tex : TEXCOORD0;
	float4 color : COLOR;
};


// Output control point
struct HS_OUTPUT
{
	float3 pos  : POSITION;
	float3 norm : NORMAL;
	float2 tex : TEXCOORD0;
};

// Output patch constant data.
struct HS_CONSTANT_DATA_OUTPUT
{
	float EdgeTessFactor[3]			: SV_TessFactor; // e.g. would be [4] for a quad domain
	float InsideTessFactor			: SV_InsideTessFactor; // e.g. would be Inside[2] for a quad domain
	// TODO: change/add other stuff
};

#define NUM_CONTROL_POINTS 3

[domain("tri")]
DS_OUTPUT DSmain(
	HS_CONSTANT_DATA_OUTPUT input,
	float3 domain : SV_DomainLocation,
	const OutputPatch<HS_OUTPUT, NUM_CONTROL_POINTS> patch)
{
	DS_OUTPUT Output;

	Output.pos = float4(patch[0].pos*domain.x + patch[1].pos*domain.y + patch[2].pos*domain.z, 1);
	Output.pos = mul(Output.pos, World);
	Output.pos = mul(Output.pos, View);
	Output.pos = mul(Output.pos, Projection);

	return Output;
}
